package com.wutianyi.maven.plugins;

import org.apache.maven.plugin.AbstractMojo;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;

import com.wutianyi.maven.packet.UnWar;

/**
 * @author hanjie.wuhj
 *@goal pre_intergation_test
 */
public class AutoConfigPreIntegrationTestMojo extends AbstractMojo {

	/**
	 * 定义的war包的位置
	 * 
	 * @parameter expression="${autoconfig.warpath}"
	 *            default-value="${project.build.directory}/${finalName}"
	 */
	private String warPath;

	
	/**
	 * 配置文件的位置
	 * @parameter expression="${autoconfig.config_properties_pat}"
	 */
	private String configPropertiesPath;
	
	/**
	 * 开发模式
	 * @parameter expression="${autoconfig.mode}" default-value="develop"
	 * 
	 */
	private String mode;
	private UnWar unWar;
	
	@Override
	public void execute() throws MojoExecutionException, MojoFailureException {
		unWar = new UnWar(warPath, configPropertiesPath, mode);
		unWar.unWar();
		unWar.close();
	}
	
	
	
	public void setWarPath(String warPath) {
		this.warPath = warPath;
	}



	public void setConfigPropertiesPath(String configPropertiesPath) {
		this.configPropertiesPath = configPropertiesPath;
	}



	public static void main(String[] args) throws MojoExecutionException, MojoFailureException {
		AutoConfigPreIntegrationTestMojo mojo = new AutoConfigPreIntegrationTestMojo();
		mojo.setWarPath("wutianyi86728_8.war");
		mojo.execute();
	}
}
